package com.yanqu.road.server.cmd.activity.jiuzhou;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.jiuzhou.CrossJiuZhouProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.jiuzhou.CrossJiuZhouMgr;
import com.yanqu.road.server.manager.activity.jiuzhou.activity.CrossJiuZhouActivity;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_JIU_ZHOU_UPLOAD_PATRONS_ABILITY, desc = "门客数据上传")
public class CrossJiuZhouPatronsUploadAbilityCmd extends CrossCommand {


    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossJiuZhouProto.CrossJiuZhouUploadPatronsAbilityMsg reqMsg = CrossJiuZhouProto.CrossJiuZhouUploadPatronsAbilityMsg.parseFrom(packet.getBytes());
        CrossJiuZhouActivity activity = CrossJiuZhouMgr.getActivity(reqMsg.getActivityId());
        if (activity == null) {
            return;
        }
        for (CrossJiuZhouProto.CrossJiuZhouPatronsUserTemp userTemp : reqMsg.getUserList()) {
            activity.changeUserPatronsList(userTemp.getUserId(), userTemp.getPatronsDataList());
        }

    }

    @Override
    public void sendData() {

    }
}
